package com.qf.dao;

import com.qf.pojo.entity.QfCourseClassify;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface QfCourseClassifyRepository extends JpaRepository<QfCourseClassify,Integer> {

    QfCourseClassify findByCourseId(Integer id);
    //使用@Modifying来标注是一个更新类的自定义语句。
    //使用@Transactional表示事务开启
    @Modifying
    @Transactional
    @Query(value = "DELETE FROM qf_course_classify WHERE course_id = ?1",nativeQuery = true)
    void deleteByCourseId(Integer id);
}
